import {Redirect} from 'umi'

export default (props) =>{
    const token = localStorage.getItem('token')

    if (props.location.pathname ==='/login'){
        if(token){
            return <Redirect    to='/home/hello'/>
        }
    }else{
        if(!token){
            return <Redirect to='/login'/>
        }
    }

return(<>{props.children}</>)


} 